package com.dt76.smallloanbackenduser.controller.jh;


import com.dt76.smallloanbackenduser.pojo.jh.MoneyNum;
import com.dt76.smallloanbackenduser.pojo.jh.MoneyType;
import com.dt76.smallloanbackenduser.remote.jh.LoanproductanalysisRemote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

@Controller
@RequestMapping("/jh")
public class LoanproductanalysisController {

    @Autowired
    private LoanproductanalysisRemote loanproductanalysisRemote;

    @GetMapping("/toLoanproductanalysis")
    public String  toLoanproductanalysis(){
        return "pages/jiang/Loanproductanalysis";
    }

    @GetMapping("/qryMonryNumTwo")
    @ResponseBody
    public MoneyType[] moneyNum(Model model){
        List<MoneyNum>  listMonry = loanproductanalysisRemote.qryMoneyNumAll();
        MoneyType [] MoneyNums = new  MoneyType[listMonry.size()];
        for (int i = 0; i<listMonry.size();i++){
            MoneyNums [i].setValue(listMonry.get(i).getMoney());
        }
        for (int i = 0; i<listMonry.size();i++){
            MoneyNums[i].setName(listMonry.get(i).getType());
        }
        System.out.println("调用成功》》》");
        return MoneyNums;
    }
}
